package Code.Objects.Characters.Enemies;

import Code.Objects.Characters.Enemies.Basic.RangedCharacter;
import Code.Objects.Characters.Enemies.Weapons.Ranged.SimpleWeapon;
import Core.DataManager;

public class RangedEnemyTest extends RangedCharacter 
{
    private double attackTimer;
    private double attackInterval;
    protected SimpleWeapon wpn;
    
    public RangedEnemyTest()
    {
        //TODO: Replace skin with new ranged enemy's
        super("Resources/Images/Characters/Enemies/Shredder/Shredder Stand 1.png");
        
        moveSpeed = 45 + (DataManager.getRandomGenerator().nextFloat() * 20);
        turnSpeed = 2.6 + (DataManager.getRandomGenerator().nextFloat() * 2);
        faction = 2;
        setToCircle(25);
        defineHealth(50);

        shadowXScale = 0.45f;
        shadowYScale = 0.37f;
        shadowDarkness = 0.5f;
        shadowXOffset = 8;
        attackInterval = 5;

        //damage = 6;
        score = 15;
        
        
        
        wpn = new SimpleWeapon(this);
        
    }
    
    public void endOfCycle(int cycle)
    {
        flipHorizontally();
    }
    
    public void attack(double time, double angle)
    {
        double offset = angle - rotation;
        if(offset < -180)
        {
            offset += 360;
        }
        else if(offset > 180)
        {
            offset -= 360;
        }
        
        attackTimer += time;
        if(attackTimer >= attackInterval)
        {
            attackTimer -= attackInterval;

            wpn.fire();
        }
    }
    
}

